mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
jps model: added API which allows to modify ant configuration
This commit is contained in:
@@ -38,8 +38,14 @@ public interface JpsAntBuildFileOptions {
|
||||
|
||||
boolean isUseProjectDefaultAnt();
|
||||
|
||||
void setUseProjectDefaultAnt(boolean useProjectDefaultAnt);
|
||||
|
||||
List<String> getAdditionalClasspath();
|
||||
|
||||
void addJarPath(@NotNull String path);
|
||||
|
||||
void addJarDirectory(@NotNull String directoryPath);
|
||||
|
||||
@NotNull
|
||||
List<BuildFileProperty> getProperties();
|
||||
|
||||
|
||||
@@ -19,6 +19,8 @@ import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.jps.model.JpsElement;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
/**
|
||||
* @author nik
|
||||
*/
|
||||
@@ -28,4 +30,9 @@ public interface JpsAntConfiguration extends JpsElement {
|
||||
|
||||
@Nullable
|
||||
String getProjectDefaultAntName();
|
||||
|
||||
void setProjectDefaultAntName(@Nullable String projectDefaultAntName);
|
||||
|
||||
@NotNull
|
||||
Collection<JpsAntBuildFileOptions> getOptionsForAllBuildFiles();
|
||||
}
|
||||
|
||||
@@ -32,6 +32,7 @@ import org.jetbrains.jps.model.artifact.JpsArtifact;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
|
||||
/**
|
||||
* @author nik
|
||||
@@ -68,6 +69,16 @@ public class JpsAntExtensionService {
|
||||
return project.getContainer().getChild(JpsAntConfigurationImpl.ROLE);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static JpsAntConfiguration getOrCreateAntConfiguration(@NotNull JpsProject project) {
|
||||
JpsAntConfiguration configuration = getAntConfiguration(project);
|
||||
if (configuration != null) {
|
||||
return configuration;
|
||||
}
|
||||
JpsAntConfigurationImpl antConfiguration = new JpsAntConfigurationImpl(new HashMap<String, JpsAntBuildFileOptions>(), null);
|
||||
return project.getContainer().setChild(JpsAntConfigurationImpl.ROLE, antConfiguration);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
private static JpsAntInstallation getBundledAntInstallation() {
|
||||
String antPath = System.getProperty(BUNDLED_ANT_PATH_PROPERTY);
|
||||
|
||||
+5
-2
@@ -45,6 +45,7 @@ public class JpsAntBuildFileOptionsImpl implements JpsAntBuildFileOptions {
|
||||
myAntCommandLineParameters = antCommandLineParameters;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setUseProjectDefaultAnt(boolean useProjectDefaultAnt) {
|
||||
myUseProjectDefaultAnt = useProjectDefaultAnt;
|
||||
}
|
||||
@@ -58,11 +59,13 @@ public class JpsAntBuildFileOptionsImpl implements JpsAntBuildFileOptions {
|
||||
myAntInstallationName = antInstallationName;
|
||||
}
|
||||
|
||||
public void addJarPath(String path) {
|
||||
@Override
|
||||
public void addJarPath(@NotNull String path) {
|
||||
myClasspath.add(path);
|
||||
}
|
||||
|
||||
public void addJarDirectory(String directoryPath) {
|
||||
@Override
|
||||
public void addJarDirectory(@NotNull String directoryPath) {
|
||||
myJarDirectories.add(directoryPath);
|
||||
}
|
||||
|
||||
|
||||
+14
-2
@@ -24,6 +24,7 @@ import org.jetbrains.jps.model.JpsElementChildRole;
|
||||
import org.jetbrains.jps.model.ex.JpsElementBase;
|
||||
import org.jetbrains.jps.model.ex.JpsElementChildRoleBase;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
@@ -31,8 +32,8 @@ import java.util.Map;
|
||||
*/
|
||||
public class JpsAntConfigurationImpl extends JpsElementBase<JpsAntConfigurationImpl> implements JpsAntConfiguration {
|
||||
public static final JpsElementChildRole<JpsAntConfiguration> ROLE = JpsElementChildRoleBase.create("ant configuration");
|
||||
private final String myProjectDefaultAntName;
|
||||
private Map<String, JpsAntBuildFileOptions> myOptionsMap = new HashMap<String, JpsAntBuildFileOptions>();
|
||||
private String myProjectDefaultAntName;
|
||||
private final Map<String, JpsAntBuildFileOptions> myOptionsMap = new HashMap<String, JpsAntBuildFileOptions>();
|
||||
|
||||
public JpsAntConfigurationImpl(Map<String, JpsAntBuildFileOptions> options, String projectDefaultAntName) {
|
||||
myProjectDefaultAntName = projectDefaultAntName;
|
||||
@@ -45,6 +46,11 @@ public class JpsAntConfigurationImpl extends JpsElementBase<JpsAntConfigurationI
|
||||
return new JpsAntConfigurationImpl(myOptionsMap, myProjectDefaultAntName);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setProjectDefaultAntName(@Nullable String projectDefaultAntName) {
|
||||
myProjectDefaultAntName = projectDefaultAntName;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public String getProjectDefaultAntName() {
|
||||
@@ -55,6 +61,12 @@ public class JpsAntConfigurationImpl extends JpsElementBase<JpsAntConfigurationI
|
||||
public void applyChanges(@NotNull JpsAntConfigurationImpl modified) {
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public Collection<JpsAntBuildFileOptions> getOptionsForAllBuildFiles() {
|
||||
return myOptionsMap.values();
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public JpsAntBuildFileOptions getOptions(@NotNull String buildFileUrl) {
|
||||
|
||||
Reference in New Issue
Block a user