Articles by xiayf

  1. 编写漂亮的 shell 代码

    2018-05-16 三
    By xiayf

    使用丑陋的编程语言也能写出漂亮的代码。

    true_then_run() {
        condition=$1
        action=$2
    
        (${condition})
        if [ $? -eq 0 ]
        then
            (${action})
        else
            echo "'$1' is false, don't run '$2'"
        fi
    }
    
    false_then_run() {
        condition=$1
        action=$2
    
        (${condition})
        if [ $? -ne 0 ]
        then
            (${action …
    标签: Bash
  2. 配置 Maven 自动化构建 protobuf 代码依赖

    2018-05-14 一
    By xiayf

    1.pom.xml 中添加如下属性配置:

    <properties>
        <!-- protobuf paths -->
        <protobuf.input.directory>${project.basedir}/src/main/protobuf</protobuf.input.directory>
        <protobuf.output.directory>${project.build.directory}/generated-sources</protobuf.output.directory>
        <!-- library versions -->
        <build-helper-maven-plugin.version>3.0.0</build-helper-maven-plugin.version>
        <maven-antrun-plugin.version>1.8</maven-antrun-plugin …
    标签: java maven protobuf

Page 2 / 3