code
stringlengths
73
34.1k
label
stringclasses
1 value
public static NarProperties getInstance(final MavenProject project) throws MojoFailureException { NarProperties instance = instances.get(project); if (instance == null) { if (project == null) { instance = new NarProperties(project, null, null); } else { String customPropertyLocatio...
java
public void setClassname(final String className) { Object proc = null; try { final Class<?> implClass = ProjectDef.class.getClassLoader().loadClass(className); try { final Method getInstance = implClass.getMethod("getInstance"); proc = getInstance.invoke(null); } catch (final E...
java
public void setOutfile(final File outfile) { // // if file name was empty, skip link step // if (outfile == null || outfile.toString().length() > 0) { this.outFile = outfile; } }
java
private File[] getSources(final List<File> sourceList) { final File[] sortedSources = new File[sourceList.size()]; sourceList.toArray(sortedSources); Arrays.sort(sortedSources, new Comparator<File>() { @Override public int compare(final File o1, final File o2) { return o1.getName().compa...
java
private void writeLinkOptions(final Writer writer, final boolean isDebug, final List<DependencyDef> dependencies, final String basePath, final TargetInfo linkTarget, final Map<String, TargetInfo> targets) throws IOException { final StringBuffer baseOptions = new StringBuffer(100); final StringBuffer opti...
java
private void writeMessage(final Writer writer, final String projectName, final String targtype) throws IOException { writer.write("!MESSAGE This is not a valid makefile. "); writer.write("To build this project using NMAKE,\r\n"); writer.write("!MESSAGE use the Export Makefile command and run\r\n"); writ...
java
private void writeSource(final Writer writer, final String basePath, final File groupMember) throws IOException { writer.write("# Begin Source File\r\n\r\nSOURCE="); String relativePath = CUtil.getRelativePath(basePath, groupMember); // // if relative path is just a name (hello.c) then // make it .\...
java
private static void encodeVersion(final StringBuffer buf, final short[] version) { for (int i = 0; i < 3; i++) { buf.append(Short.toString(version[i])); buf.append(','); } buf.append(Short.toString(version[3])); }
java
private static boolean hasSameContent(final InputStream stream1, final InputStream stream2) throws IOException { int byte1 = -1; int byte2 = -1; do { byte1 = stream1.read(); byte2 = stream2.read(); } while (byte1 == byte2 && byte1 != -1); return byte1 == byte2; }
java
public static short[] parseVersion(final String version) { final short[] values = new short[] { 0, 0, 0, 0 }; if (version != null) { final StringBuffer buf = new StringBuffer(version); int start = 0; for (int i = 0; i < 4; i++) { int end = version.indexOf('.', start); ...
java
public void setDir(final File dir) throws BuildException { if (this.localSet == null) { this.localSet = new ConditionalFileSet(); this.owner.appendExceptFileSet(this.localSet); } this.localSet.setDir(dir); }
java
public void setIncludes(final String includes) { if (this.localSet == null) { this.localSet = new ConditionalFileSet(); this.owner.appendExceptFileSet(this.localSet); } this.localSet.setIncludes(includes); }
java
public void setLocal(final File value) { if (value == null) { throw new NullPointerException("value"); } if (value.exists() && !value.isDirectory()) { throw new BuildException("local should be a directory"); } this.localName = value; try { this.canonicalPath = this.localName.ge...
java
public String toRemote(final String host, final File localFile) { if (this.remoteName != null && (this.hosts == null || this.hosts.contains(host))) { try { final String canonical = localFile.getCanonicalPath(); if (canonical.startsWith(this.canonicalPath) && isActive()) { return th...
java
public static boolean hasQObject(final Reader reader) throws IOException { final MetaObjectParser parser = new MetaObjectParser(); parser.parse(reader); return parser.hasQObject; }
java
protected org.eclipse.aether.graph.DependencyNode getVerboseDependencyTree () { // Create CollectRequest object that will be submitted to collect the dependencies CollectRequest collectReq = new CollectRequest(); // Get artifact this Maven project is attempting to build Artifact art = getMavenProject...
java
protected DependencyNode getRootNodeDependecyTree() throws MojoExecutionException{ try { ArtifactFilter artifactFilter = null; // works for only maven 3. Use of dependency graph component not handled for maven 2 // as current version of NAR already requires Maven 3.x rootNode = dependencyGr...
java
protected static String getIdentifier(final String[] command, final String fallback) { String identifier = fallback; try { final String[] cmdout = CaptureStreamHandler.run(command); if (cmdout.length > 0) { identifier = cmdout[0]; } } catch (final Throwable ex) { identifier =...
java
private static String registryGet32StringValue(com.sun.jna.platform.win32.WinReg.HKEY root, String key, String value) throws com.sun.jna.platform.win32.Win32Exception { com.sun.jna.platform.win32.WinReg.HKEYByReference phkKey = new com.sun.jna.platform.win32.WinReg.HKEYByReference(); int rc = com.sun.jna....
java
public static UndefineArgument[] merge(final UndefineArgument[] base, final UndefineArgument[] override) { if (base.length == 0) { final UndefineArgument[] overrideClone = override.clone(); return overrideClone; } if (override.length == 0) { final UndefineArgument[] baseClone = base.clone(...
java
public static String[] run(final String[] cmdline) { final CaptureStreamHandler handler = execute(cmdline); return handler.getOutput() != null ? handler.getOutput() : new String[0]; }
java
public void gatherOutput() { try { final Copier errorCopier = new Copier(this.processErrorStream); final Copier outputCopier = new Copier(this.processOutputStream); errorCopier.start(); outputCopier.start(); errorCopier.join(); outputCopier.join(); this.stderr = new String[...
java
public static File[] getEnvironmentPath(final String toolName, final char switchChar, final String[] defaultRelativePath) { if (toolName == null) { throw new NullPointerException("toolName"); } if (defaultRelativePath == null) { throw new NullPointerException("defaultRelativePath"); } ...
java
@Override public String decorateLinkerOption(final StringBuffer buf, final String arg) { String decoratedArg = arg; if (arg.length() > 1 && arg.charAt(0) == '-') { switch (arg.charAt(1)) { // // passed automatically by GCC // case 'g': case 'f': case 'F': ...
java
public final List/* <AttachedNarArtifact> */getAttachedNarDependencies(final List/* * < * NarArtifacts ...
java
@Override public void compile(final CCTask task, final File outputDir, final String[] sourceFiles, final String[] args, final String[] endArgs, final boolean relentless, final CommandLineCompilerConfiguration config, final ProgressMonitor monitor) { BuildException exc = null; final String[] thisS...
java
private String getActivePlatform(final CCTask task) { final String osName = System.getProperty("os.name").toLowerCase(Locale.US); if (osName.contains("windows")) { return "win32"; } return "linux"; }
java
private String getBuildType(final CCTask task) { final String outType = task.getOuttype(); if ("executable".equals(outType)) { return "exeproject"; } else if ("static".equals(outType)) { return "libraryproject"; } return "dllproject"; }
java
private void writeCompileOptions(final String baseDir, final PropertyWriter writer, final CommandLineCompilerConfiguration compilerConfig) throws SAXException { boolean isBcc = false; boolean isUnix = true; String compileID = "linux.Debug_Build.gnuc++.g++compile"; if (compilerConfig.getCompiler() ...
java
private void writeIlinkArgs(final PropertyWriter writer, final String linkID, final String[] args) throws SAXException { for (final String arg : args) { if (arg.charAt(0) == '/' || arg.charAt(0) == '-') { final int equalsPos = arg.indexOf('='); if (equalsPos > 0) { final String...
java
private void writeLdArgs(final PropertyWriter writer, final String linkID, final String[] preArgs) throws SAXException { int objnameIndex = 1; int libnameIndex = 1; int libpathIndex = 1; for (final String preArg : preArgs) { if (preArg.startsWith("-o")) { writer.write(linkID, "option...
java
private void writeLinkOptions(final String baseDir, final PropertyWriter writer, final TargetInfo linkTarget) throws SAXException { if (linkTarget != null) { final ProcessorConfiguration config = linkTarget.getConfiguration(); if (config instanceof CommandLineLinkerConfiguration) { final C...
java
@Override protected final void addImpliedArgs(final Vector<String> args, final boolean debug, final boolean multithreaded, final boolean exceptions, final LinkType linkType, final Boolean rtti, final OptimizationEnum optimization) { args.addElement("/c"); if (exceptions) { args.addElement("/xs"); ...
java
@Override protected final void addWarningSwitch(final Vector<String> args, final int level) { OpenWatcomProcessor.addWarningSwitch(args, level); }
java
@Override protected final void getDefineSwitch(final StringBuffer buffer, final String define, final String value) { OpenWatcomProcessor.getDefineSwitch(buffer, define, value); }
java
@Override protected final void getUndefineSwitch(final StringBuffer buffer, final String define) { OpenWatcomProcessor.getUndefineSwitch(buffer, define); }
java
public static Map<CompilerConfiguration, Vector<TargetInfo>> getTargetsToBuildByConfiguration( final Map<String, TargetInfo> targets) { final Map<CompilerConfiguration, Vector<TargetInfo>> targetsByConfig = new HashMap<>(); for (final TargetInfo target : targets.values()) { if (target.getRebuild()) ...
java
public void addConfiguredCompiler(final CompilerDef compiler) { if (compiler == null) { throw new NullPointerException("compiler"); } compiler.setProject(getProject()); this._compilers.addElement(compiler); }
java
public void addConfiguredLinker(final LinkerDef linker) { if (linker == null) { throw new NullPointerException("linker"); } linker.setProject(getProject()); this._linkers.addElement(linker); }
java
protected int checkForChangedIncludeFiles(final Map<String, TargetInfo> targets) { int potentialTargets = 0; int definiteTargets = 0; Iterator<TargetInfo> targetEnum = targets.values().iterator(); while (targetEnum.hasNext()) { final TargetInfo target = targetEnum.next(); if (!target.getRebu...
java
public void setName(final CompilerEnum name) { this.compilerDef.setName(name); final Processor compiler = this.compilerDef.getProcessor(); final Linker linker = compiler.getLinker(this.linkType); this.linkerDef.setProcessor(linker); }
java
public void setNewenvironment(final boolean newenv) { this.compilerDef.setNewenvironment(newenv); for (int i = 0; i < this._compilers.size(); i++) { final CompilerDef currentCompilerDef = this._compilers.elementAt(i); currentCompilerDef.setNewenvironment(newenv); } this.linkerDef.setNewenvir...
java
public void setOutfile(final File outfile) { // // if file name was empty, skip link step // if (outfile == null || outfile.toString().length() > 0) { this._outfile = outfile; } }
java
@Override public void setProject(final Project project) { super.setProject(project); this.compilerDef.setProject(project); this.linkerDef.setProject(project); }
java
public VersionInfo merge() { if (isReference()) { final VersionInfo refVersion = (VersionInfo) getCheckedRef(VersionInfo.class, "VersionInfo"); return refVersion.merge(); } Reference currentRef = this.getExtends(); if (currentRef == null) { return this; } final Vector<VersionIn...
java
public static String[] getOutputFileSwitch(final String outPath) { final StringBuffer buf = new StringBuffer("/fo="); if (outPath.indexOf(' ') >= 0) { buf.append('\"'); buf.append(outPath); buf.append('\"'); } else { buf.append(outPath); } final String[] retval = new String[]...
java
@Override public Linker getLinker(final LinkType type) { if (type.isStaticLibrary()) { return OpenWatcomLibrarian.getInstance(); } if (type.isSharedLibrary()) { return DLL_LINKER; } return INSTANCE; }
java
public DistributerMap createMap() { final DistributerMap map = new DistributerMap(); map.setProject(getProject()); this.maps.addElement(map); return map; }
java
public String getHosts() { if (isReference()) { final DistributerDef refDistributer = (DistributerDef) getCheckedRef(DistributerDef.class, "DistributerDef"); return refDistributer.getHosts(); } return this.hosts; }
java
public DistributerProtocolEnum getProtocol() { if (isReference()) { final DistributerDef refDistributer = (DistributerDef) getCheckedRef(DistributerDef.class, "DistributerDef"); return refDistributer.getProtocol(); } return this.protocol; }
java
public int getTcpcork() { if (isReference()) { final DistributerDef refDistributer = (DistributerDef) getCheckedRef(DistributerDef.class, "DistributerDef"); return refDistributer.getTcpcork(); } return this.tcpCork; }
java
public void link(final CCTask task, final File outputFile, final String[] sourceFiles, final CommandLineLinkerConfiguration config) throws BuildException { final File parentDir = new File(outputFile.getParent()); String parentPath; try { parentPath = parentDir.getCanonicalPath(); } catch (fi...
java
protected String prepareFilename(final StringBuffer buf, final String outputDir, final String sourceFile) { // FREEHEP BEGIN exit if absolute path is too long. Max length on relative // paths in windows is even shorter. if (isWindows() && sourceFile.length() > this.maxPathLength) { throw new BuildExce...
java
@Override public final String[] getLibraryPatterns(final String[] libnames, final LibraryTypeEnum libType) { return OpenWatcomProcessor.getLibraryPatterns(libnames, libType); }
java
public void addConfiguredDefineset(final DefineSet defs) { if (defs == null) { throw new NullPointerException("defs"); } if (isReference()) { throw noChildrenAllowed(); } this.defineSets.addElement(defs); }
java
public IncludePath createIncludePath() { final Project p = getProject(); if (p == null) { throw new java.lang.IllegalStateException("project must be set"); } if (isReference()) { throw noChildrenAllowed(); } final IncludePath path = new IncludePath(p); this.includePaths.addElemen...
java
public PrecompileDef createPrecompile() throws BuildException { final Project p = getProject(); if (isReference()) { throw noChildrenAllowed(); } final PrecompileDef precomp = new PrecompileDef(); precomp.setProject(p); this.precompileDefs.addElement(precomp); return precomp; }
java
public SystemIncludePath createSysIncludePath() { final Project p = getProject(); if (p == null) { throw new java.lang.IllegalStateException("project must be set"); } if (isReference()) { throw noChildrenAllowed(); } final SystemIncludePath path = new SystemIncludePath(p); this.s...
java
@Override public void setClassname(final String classname) throws BuildException { if (isReference()) { throw tooManyAttributes(); } super.setClassname(classname); final Processor proc = getProcessor(); if (!(proc instanceof Compiler)) { throw new BuildException(classname + " does not ...
java
public void setName(final CompilerEnum name) throws BuildException { if (isReference()) { throw tooManyAttributes(); } final Compiler compiler = name.getCompiler(); setProcessor(compiler); }
java
public void addFileset(final ConditionalFileSet srcSet) throws BuildException { if (isReference()) { throw noChildrenAllowed(); } srcSet.setProject(getProject()); this.srcSets.addElement(srcSet); }
java
public ProcessorConfiguration createConfiguration(final CCTask task, final LinkType linkType, final ProcessorDef baseDef, final TargetDef targetPlatform, final VersionInfo versionInfo) { if (isReference()) { return ((ProcessorDef) getCheckedRef(ProcessorDef.class, "ProcessorDef")).createConfiguration(ta...
java
public boolean getDebug(final ProcessorDef[] defaultProviders, final int index) { if (isReference()) { return ((ProcessorDef) getCheckedRef(ProcessorDef.class, "ProcessorDef")).getDebug(defaultProviders, index); } if (this.debug != null) { return this.debug.booleanValue(); } else { if ...
java
protected final ProcessorDef[] getDefaultProviders(final ProcessorDef baseDef) { ProcessorDef extendsDef = getExtends(); final Vector chain = new Vector(); while (extendsDef != null && !chain.contains(extendsDef)) { chain.addElement(extendsDef); extendsDef = extendsDef.getExtends(); } if...
java
public ProcessorDef getExtends() throws BuildException { if (this.extendsRef != null) { final Object obj = this.extendsRef.getReferencedObject(getProject()); if (!getClass().isInstance(obj)) { throw new BuildException("Referenced object " + this.extendsRef.getRefId() + " not correct type, is " ...
java
public boolean getRebuild(final ProcessorDef[] defaultProviders, final int index) { if (isReference()) { return ((ProcessorDef) getCheckedRef(ProcessorDef.class, "ProcessorDef")).getRebuild(defaultProviders, index); } if (this.rebuild != null) { return this.rebuild.booleanValue(); } else { ...
java
public void setClassname(final String className) throws BuildException { Object proc = null; try { final Class implClass = ProcessorDef.class.getClassLoader().loadClass(className); try { final Method getInstance = implClass.getMethod("getInstance"); proc = getInstance.invoke(null); ...
java
protected void setProcessor(final Processor processor) throws BuildException, NullPointerException { if (processor == null) { throw new NullPointerException("processor"); } if (isReference()) { throw super.tooManyAttributes(); } if (this.env == null && !this.newEnvironment) { this....
java
@Override public void setRefid(final org.apache.tools.ant.types.Reference ref) { super.setRefid(ref); }
java
public void visitFiles(final FileVisitor visitor) { final Project p = getProject(); if (p == null) { throw new java.lang.IllegalStateException("project must be set before this call"); } if (isReference()) { ((ProcessorDef) getCheckedRef(ProcessorDef.class, "ProcessorDef")).visitFiles(visitor...
java
public String getDataset() { if (isReference()) { final LibrarySet master = (LibrarySet) getCheckedRef(LibrarySet.class, "LibrarySet"); return master.getDataset(); } return this.dataset; }
java
public LibraryTypeEnum getType() { if (isReference()) { final LibrarySet master = (LibrarySet) getCheckedRef(LibrarySet.class, "LibrarySet"); return master.getType(); } return this.libraryType; }
java
public void setLibs(final CUtil.StringArrayBuilder libs) throws BuildException { if (isReference()) { throw tooManyAttributes(); } this.libnames = libs.getValue(); // // earlier implementations would warn of suspicious library names // (like libpthread for pthread or kernel.lib for kernel)...
java
public ArchEnum getArch() { if (isReference()) { final TargetDef refPlatform = (TargetDef) getCheckedRef(TargetDef.class, "TargetDef"); return refPlatform.getArch(); } return this.arch; }
java
public CPUEnum getCpu() { if (isReference()) { final TargetDef refPlatform = (TargetDef) getCheckedRef(TargetDef.class, "TargetDef"); return refPlatform.getCpu(); } return this.cpu; }
java
public OSFamilyEnum getOsfamily() { if (isReference()) { final TargetDef refPlatform = (TargetDef) getCheckedRef(TargetDef.class, "TargetDef"); return refPlatform.getOsfamily(); } return this.osFamily; }
java
public void setArch(final ArchEnum value) { if (isReference()) { throw tooManyAttributes(); } if (this.cpu != null) { throw tooManyAttributes(); } this.arch = value; }
java
public void setOsfamily(final OSFamilyEnum value) { if (isReference()) { throw tooManyAttributes(); } if (this.cpu != null) { throw tooManyAttributes(); } this.osFamily = value; }
java
public UndefineArgument[] getDefines() throws BuildException { if (isReference()) { final DefineSet defset = (DefineSet) getCheckedRef(DefineSet.class, "DefineSet"); return defset.getDefines(); } else { if (isActive()) { final UndefineArgument[] defs = new UndefineArgument[this.defineL...
java
public void setDefine(final CUtil.StringArrayBuilder defList) throws BuildException { if (isReference()) { throw tooManyAttributes(); } addDefines(defList.getValue(), true); }
java
@Override public void setRefid(final Reference r) throws BuildException { if (!this.defineList.isEmpty()) { throw tooManyAttributes(); } super.setRefid(r); }
java
public void setUndefine(final CUtil.StringArrayBuilder undefList) throws BuildException { if (isReference()) { throw tooManyAttributes(); } addDefines(undefList.getValue(), false); }
java
public final String[] getAttachedNars(final AOL aol, final String type) { final String attachedNars = getProperty(aol, NarConstants.NAR + "." + type); return attachedNars != null ? attachedNars.split(",") : null; }
java
public DependencyInfo getDependencyInfo(final String sourceRelativeName, final String includePathIdentifier) { DependencyInfo dependInfo = null; final DependencyInfo[] dependInfos = (DependencyInfo[]) this.dependencies.get(sourceRelativeName); if (dependInfos != null) { for (final DependencyInfo depen...
java
public boolean needsRebuild(final CCTask task, final TargetInfo target, final int dependencyDepth) { // look at any files where the compositeLastModified // is not known, but the includes are known // boolean mustRebuild = false; final CompilerConfiguration compiler = (CompilerConfiguration) target....
java
@Override public final void narExecute() throws MojoExecutionException, MojoFailureException { // download the dependencies if needed in local maven repository. List<AttachedNarArtifact> attachedNarArtifacts = getAttachedNarArtifacts(libraries); downloadAttachedNars(attachedNarArtifacts); // Warning,...
java
public LibrarySet[] getActiveLibrarySets(final LinkerDef[] defaultProviders, final int index) { if (isReference()) { return ((LinkerDef) getCheckedRef(LinkerDef.class, "LinkerDef")) .getActiveUserLibrarySets(defaultProviders, index); } final Project p = getProject(); final Vector libsets...
java
public void setName(final LinkerEnum name) throws BuildException { if (isReference()) { throw tooManyAttributes(); } final Linker linker = name.getLinker(); super.setProcessor(linker); }
java
@Override public String[] getOutputFileNames(final String inputFile, final VersionInfo versionInfo) { if (inputFile.endsWith(".cpp")) { return super.getOutputFileNames(inputFile, versionInfo); } // // if a recognized input file // final String baseName = getBaseOutputName(inputFile); ...
java
private static PBXObjectRef createPBXBuildFile(final PBXObjectRef fileRef, final Map settings) { final Map map = new HashMap(); map.put("fileRef", fileRef); map.put("isa", "PBXBuildFile"); if (settings != null) { map.put("settings", settings); } return new PBXObjectRef(map); }
java
private static PBXObjectRef createPBXCopyFilesBuildPhase(final int buildActionMask, final String dstPath, final String dstSubfolderSpec, final List files, final boolean runOnly) { final Map map = new HashMap(); map.put("isa", "PBXCopyFilesBuildPhase"); map.put("buildActionMask", NumberFormat.getIntege...
java
private static PBXObjectRef createPBXFileReference(final String sourceTree, final String baseDir, final File file) { final Map map = new HashMap(); map.put("isa", "PBXFileReference"); final String relPath = CUtil.toUnixPath(CUtil.getRelativePath(baseDir, file)); map.put("path", relPath); map.put("n...
java
private static PBXObjectRef createPBXFrameworksBuildPhase(final int buildActionMask, final List files, final boolean runOnly) { final Map map = new HashMap(); map.put("isa", "PBXFrameworksBuildPhase"); map.put("buildActionMask", NumberFormat.getIntegerInstance(Locale.US).format(buildActionMask)); ...
java
private static PBXObjectRef createPBXGroup(final String name, final String sourceTree, final List children) { final Map map = new HashMap(); map.put("isa", "PBXGroup"); map.put("name", name); map.put("sourceTree", sourceTree); map.put("children", children); return new PBXObjectRef(map); }
java
private static PBXObjectRef createPBXNativeTarget(final String name, final PBXObjectRef buildConfigurationList, final List buildPhases, final List buildRules, final List dependencies, final String productInstallPath, final String productName, final PBXObjectRef productReference, final String productType) { ...
java
private static PBXObjectRef createPBXProject(final PBXObjectRef buildConfigurationList, final PBXObjectRef mainGroup, final String projectDirPath, final String projectRoot, final List targets) { final Map map = new HashMap(); map.put("isa", "PBXProject"); map.put("buildConfigurationList", buildConfigu...
java
private static PBXObjectRef createPBXSourcesBuildPhase(final int buildActionMask, final List files, final boolean runOnly) { final Map map = new HashMap(); map.put("buildActionMask", String.valueOf(buildActionMask)); map.put("files", files); map.put("isa", "PBXSourcesBuildPhase"); map.put("run...
java
private static PBXObjectRef createXCBuildConfiguration(final String name, final Map<String, ?> buildSettings) { final Map map = new HashMap(); map.put("isa", "XCBuildConfiguration"); map.put("buildSettings", buildSettings); map.put("name", name); return new PBXObjectRef(map); }
java
private static PBXObjectRef createXCConfigurationList(final List buildConfigurations) { final Map map = new HashMap(); map.put("isa", "XCConfigurationList"); map.put("buildConfigurations", buildConfigurations); return new PBXObjectRef(map); }
java
private PBXObjectRef addDependency(final Map objects, final PBXObjectRef project, final List mainGroupChildren, final String baseDir, final DependencyDef dependency) { if (dependency.getFile() != null) { final File xcodeDir = new File(dependency.getFile().getAbsolutePath() + ".xcodeproj"); if (xco...
java