This repository has been archived by the owner on Oct 7, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add condaBuild task to trigger conda build (#35)
* Add condaBuild task to trigger conda build * React to CR * Add install task for conda build * React to Justin's comments * Satisfy Checkstyle * Fix circle jvm brokenness by upgrading * Make conda build --output-folder configurable * Build with no upload, fail if meta.yaml broken, up to date setupCondaBuild * Add condaBuildCheck to verify meta.yaml * Use conda in bootstrap dir for setupCondaBuild * Show more output in circle * ignore exit value of check for conda build
- Loading branch information
1 parent
c5ed1d9
commit 3a1ebd5
Showing
20 changed files
with
498 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,3 +4,4 @@ | |
/build/ | ||
*.ipr | ||
*.iws | ||
out |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
35 changes: 35 additions & 0 deletions
35
src/main/java/com/palantir/python/miniconda/MinicondaUtils.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
/* | ||
* Copyright 2017 Palantir Technologies, Inc. All rights reserved. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package com.palantir.python.miniconda; | ||
|
||
import java.util.ArrayList; | ||
import java.util.Collections; | ||
import java.util.List; | ||
|
||
public final class MinicondaUtils { | ||
|
||
public static List<String> convertChannelsToArgs(List<String> channels) { | ||
List<String> args = new ArrayList<>(); | ||
for (String channel : channels) { | ||
args.add("--channel"); | ||
args.add(channel); | ||
} | ||
return Collections.unmodifiableList(args); | ||
} | ||
|
||
private MinicondaUtils() {} | ||
} |
70 changes: 70 additions & 0 deletions
70
src/main/java/com/palantir/python/miniconda/tasks/CondaBuild.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
/* | ||
* Copyright 2017 Palantir Technologies, Inc. All rights reserved. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package com.palantir.python.miniconda.tasks; | ||
|
||
import com.palantir.python.miniconda.MinicondaExtension; | ||
import com.palantir.python.miniconda.MinicondaUtils; | ||
import java.util.Objects; | ||
import org.gradle.api.tasks.AbstractExecTask; | ||
import org.gradle.api.tasks.TaskContainer; | ||
import org.slf4j.Logger; | ||
import org.slf4j.LoggerFactory; | ||
|
||
/** | ||
* Task which builds and packages a Conda package. | ||
* | ||
* @author jakobjuelich | ||
*/ | ||
public class CondaBuild extends AbstractExecTask<CondaBuild> { | ||
private static final Logger LOG = LoggerFactory.getLogger(CondaBuild.class); | ||
|
||
private static final String DEFAULT_GROUP = "build"; | ||
private static final String DEFAULT_DESCRIPTION = "Builds conda package using conda-build."; | ||
|
||
public static CondaBuild createTask(TaskContainer tasks, CondaBuildCheck condaBuildCheck) { | ||
Objects.requireNonNull(tasks, "tasks must not be null"); | ||
Objects.requireNonNull(condaBuildCheck, "condaBuildCheck must not be null"); | ||
|
||
CondaBuild task = tasks.create("condaBuild", CondaBuild.class); | ||
task.setGroup(DEFAULT_GROUP); | ||
task.setDescription(DEFAULT_DESCRIPTION); | ||
task.dependsOn(condaBuildCheck); | ||
|
||
CleanTaskUtils.createCleanupTask(tasks, task); | ||
return task; | ||
} | ||
|
||
public CondaBuild() { | ||
super(CondaBuild.class); | ||
} | ||
|
||
public void configureAfterEvaluate(final MinicondaExtension miniconda) { | ||
Objects.requireNonNull(miniconda, "miniconda must not be null"); | ||
|
||
executable(miniconda.getBuildEnvironmentDirectory().toPath().resolve("bin/conda")); | ||
args("build", miniconda.getMetaYaml()); | ||
args("--override-channels"); | ||
args("--no-anaconda-upload"); | ||
args(MinicondaUtils.convertChannelsToArgs(miniconda.getChannels())); | ||
if (miniconda.getBuildOutputDirectory() != null) { | ||
args("--output-folder", miniconda.getBuildOutputDirectory().getAbsolutePath()); | ||
} | ||
|
||
LOG.info("{} configured to execute {}", getName(), getCommandLine()); | ||
} | ||
|
||
} |
64 changes: 64 additions & 0 deletions
64
src/main/java/com/palantir/python/miniconda/tasks/CondaBuildCheck.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
/* | ||
* Copyright 2017 Palantir Technologies, Inc. All rights reserved. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package com.palantir.python.miniconda.tasks; | ||
|
||
import com.palantir.python.miniconda.MinicondaExtension; | ||
import java.util.Objects; | ||
import org.gradle.api.tasks.AbstractExecTask; | ||
import org.gradle.api.tasks.TaskContainer; | ||
import org.slf4j.Logger; | ||
import org.slf4j.LoggerFactory; | ||
|
||
/** | ||
* Task to run conda build --check to only check (validate) the recipe. | ||
* | ||
* @author jakobjuelich | ||
*/ | ||
public class CondaBuildCheck extends AbstractExecTask<CondaBuildCheck> { | ||
private static final Logger LOG = LoggerFactory.getLogger(CondaBuildCheck.class); | ||
|
||
private static final String DEFAULT_GROUP = "build"; | ||
private static final String DEFAULT_DESCRIPTION = "Runs `conda build --check` to only check (validate) the recipe."; | ||
|
||
public static CondaBuildCheck createTask(TaskContainer tasks, SetupCondaBuild setupCondaBuild) { | ||
Objects.requireNonNull(tasks, "tasks must not be null"); | ||
Objects.requireNonNull(setupCondaBuild, "setupCondaBuild must not be null"); | ||
|
||
CondaBuildCheck task = tasks.create("condaBuildCheck", CondaBuildCheck.class); | ||
task.setGroup(DEFAULT_GROUP); | ||
task.setDescription(DEFAULT_DESCRIPTION); | ||
task.dependsOn(setupCondaBuild); | ||
|
||
CleanTaskUtils.createCleanupTask(tasks, task); | ||
return task; | ||
} | ||
|
||
public CondaBuildCheck() { | ||
super(CondaBuildCheck.class); | ||
} | ||
|
||
public void configureAfterEvaluate(final MinicondaExtension miniconda) { | ||
Objects.requireNonNull(miniconda, "miniconda must not be null"); | ||
|
||
executable(miniconda.getBuildEnvironmentDirectory().toPath().resolve("bin/conda")); | ||
args("build", miniconda.getMetaYaml()); | ||
args("--check"); | ||
|
||
LOG.info("{} configured to execute {}", getName(), getCommandLine()); | ||
} | ||
|
||
} |
Oops, something went wrong.